﻿@using WsdShop.Model
@using WsdShop.Model.ViewModels
@{
    Layout = "";
    List<V_Coupon> ulist = ViewBag.UList;
    List<V_Coupon> nlist = ViewBag.NList;
    List<V_Coupon> glist = ViewBag.GList;
}

<!-- 优惠券类别切换 -->
<div class="flayout_b_tabBox">
    <ul>
        <li class="active"><a>可用</a></li>
        <li><a>已用</a></li>
        <li><a>过期</a></li>
    </ul>
    <div class="clear"></div>
</div>
<!--end 优惠券类别切换 -->
<!-- 优惠券列表 -->
<div class="flayout_b_mainBox">
    <!-- 可用 -->
    <div class="flayout_b_mainEachTab">
        
        @foreach (V_Coupon item in nlist)
        {
            <div class="flayout_b_eachRow blue">
                <div class="leftbox ">
                    <p><img src="/Content/images/f_03.png" alt="优惠券"></p>

                </div>
                <div class="rightbox">
                    <div class="b_rtop">
                        <div class="left_price "><span>¥</span>@item.Amount.ToString("0")</div>
                        <div class="right_rule">
                            <p class="p1 ">@(item.Category>0? "限" + item.CategoryName + "类  使用":"全品类")</p>
                            <p class="p2">@(item.Consumption==0?"无限制":"满"+item.Consumption.ToString("0")+ "元可用")</p>
                        </div>
                    </div>
                    <div class="b_rbottom">
                        <p>有效期：@(item.StartTime.ToString("yyyy-MM-dd"))至@(item.EndTime.ToString("yyyy-MM-dd"))</p>
                    </div>
                </div>
            </div>
        }
    </div>
    <!-- 可用 -->
    <!-- 已用 -->
    <div class="flayout_b_mainEachTab gray expires" style="display: none">
        @foreach (V_Coupon item in ulist)
        {
            <div class="flayout_b_eachRow blue">
                <div class="leftbox ">
                    <p><img src="/Content/images/f_03.png" alt="优惠券"></p>

                </div>
                <div class="rightbox">
                    <div class="b_rtop">
                        <div class="left_price "><span>¥</span>@item.Amount.ToString("0")</div>
                        <div class="right_rule">
                            <p class="p1 ">@(item.Category > 0 ? "限" + item.CategoryName + "类  使用": "全品类")</p>
                            <p class="p2">@(item.Consumption == 0 ? "无限制" : "满" + item.Consumption.ToString("0") + "元可用")</p>
                        </div>
                    </div>
                    <div class="b_rbottom">
                        <p>有效期：@(item.StartTime.ToString("yyyy-MM-dd"))至@(item.EditTime.ToString("yyyy-MM-dd"))</p>
                    </div>
                </div>
            </div>
        }
    </div>

    <!--end 已用 -->
    <!-- 过期 -->
    <div class="flayout_b_mainEachTab gray" style="display: none">
        @foreach (V_Coupon item in glist)
        {
            <div class="flayout_b_eachRow blue">
                <div class="leftbox ">
                    <p><img src="/Content/images/f_03.png" alt="优惠券"></p>

                </div>
                <div class="rightbox">
                    <div class="b_rtop">
                        <div class="left_price "><span>¥</span>@item.Amount.ToString("0")</div>
                        <div class="right_rule">
                            <p class="p1 ">@(item.Category > 0 ? "限" + item.CategoryName + "类  使用": "全品类")</p>
                            <p class="p2">@(item.Consumption == 0 ? "无限制" : "满" + item.Consumption.ToString("0") + "元可用")</p>
                        </div>
                    </div>
                    <div class="b_rbottom">
                        <p>有效期：@(item.StartTime.ToString("yyyy-MM-dd"))至@(item.EditTime.ToString("yyyy-MM-dd"))</p>
                    </div>
                </div>
            </div>
        }
    </div>
    <!-- 过期 -->

</div>
<!-- 优惠券列表 -->
<script>
		$(".flayout_b_tabBox ul li").each(function(e) {

			$(this).click(function() {
				$(".flayout_b_tabBox ul li").removeClass('active');
				$(this).addClass('active');
				$(".flayout_b_mainBox .flayout_b_mainEachTab").hide();
				$(".flayout_b_mainBox .flayout_b_mainEachTab:eq("+e+")").show();
			});

		});
</script>
